#include "../headers/iluminacao.h"

void Iluminacao::setupRC()
	{
		glDepthFunc(GL_LESS);									// The Type Of Depth Test To Do
		glEnable(GL_DEPTH_TEST);								// Enables Depth Testing
		glFrontFace(GL_CCW);									// Counterclockwise polygons face out
		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);		// Clear the color and depth buffer
		glEnable( GL_LIGHTING );

		GLfloat diffuseLight[] = { 0.7, 0.7, 0.7, 1.0 };		/// RGBA, vary the 3 first paramaters to change the light color and intensity.   
		 glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuseLight );		/// Create the light source
		 glEnable( GL_LIGHT0 );									/// Light it!

		 glEnable( GL_COLOR_MATERIAL );
			glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );

		GLfloat ambientLight[] = { 0.05, 0.05, 0.05, 1.0 };		/// Define color and intensity
		glLightfv( GL_LIGHT0, GL_AMBIENT, ambientLight );		/// Add ambient component

		GLfloat specularLight[] = { 0.7, 0.7, 0.7, 1.0 };
		GLfloat spectre[] = { 1.0, 1.0, 1.0, 1.0 };

		glLightfv( GL_LIGHT0, GL_SPECULAR, specularLight );
		glMaterialfv( GL_FRONT, GL_SPECULAR, spectre );
		glMateriali( GL_FRONT, GL_SHININESS, 128 );

		GLfloat lightPos[] = { 600.0, 10.0, 200.0, 1.0 };        ///posição da fonte de luz
			glLightfv( GL_LIGHT0, GL_POSITION, lightPos );		

	} 